package com.pen.changgou.goods.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pen.changgou.common.core.utils.R;
import com.pen.changgou.goods.entity.Category;
import com.pen.changgou.goods.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.pen.changgou.goods.mapper.ParaMapper;
import com.pen.changgou.goods.entity.Para;
import com.pen.changgou.goods.service.ParaService;


@Service("paraService")
public class ParaServiceImpl extends ServiceImpl<ParaMapper, Para> implements ParaService {
    @Autowired
    CategoryMapper categoryMapper;


    @Override
    public R findByCategory(Long id) {
        Category category = categoryMapper.selectById(id);
        return R.ok(baseMapper
                .selectList(Wrappers.<Para>lambdaQuery().eq(Para::getTemplateId, category.getTemplateId())));


    }
}